package CCF_2014;

import java.util.Scanner;

public class T201409_2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int count = Integer.valueOf(scanner.nextLine());
        boolean allGrids[][] = new boolean[100][100];
        int rectangle[];
        for (int i = 0; i < count; i++) {
            rectangle = StringToInt(scanner.nextLine().split(" "));
            for (int j = rectangle[0]; j < rectangle[2]; j++) {
                for (int k = rectangle[1]; k < rectangle[3]; k++) {
                    if (!allGrids[j][k]) {
                        allGrids[j][k]=true;
                    }
                }
            }
        }
        scanner.close();
        int sum=0;
        for (int i = 0; i < 100; i++) {
            for (int j = 0; j < 100; j++) {
                if (allGrids[i][j]) {
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }

    private static int[] StringToInt(String ss[]) {
        int array[] = new int[ss.length];
        for (int i = 0;i<ss.length;i++) {
            array[i] = Integer.valueOf(ss[i]);
        }
        return array;
    }

}
